<!DOCTYPE html>
<html>
<head>
    <title>从【自由变量】到【作用域链】</title>
    <meta charset="utf-8"/>
    <script src="../../js/jquery-1.10.1.min.js"></script>
    <script>
//        var x = 10;
//        function fn(){
//            console.log(x);
//        }
//
//        function show(f){
//            var x = 20;
//
//            (function(){
//                f();
//            })();
//        }
//        show(fn);

        var a = 10;

        function fn(){
            var b = 20;

            function bar(){
                console.log(a + b);
            }

            return bar;
        }

        var x = fn(), b = 200;
        console.log("xxx:" + x);
        console.log("fn()fn()fn():" + fn());
        console.log("fnfnfn:" + fn);
        //x();
    </script>
</head>
<body>
<!--http://www.cnblogs.com/wangfupeng1988/p/3977924.html-->
    <p>简介【作用域】</p>
</body>
</html>